#include "coordinate.h"

//空滑块的下标
Coordinate::Coordinate(int N0){
    rN = N0;
    x = y = rN - 1;
}
//其他滑块
Coordinate::Coordinate(int a, int b, int N0){
    x = a;
    y = b;
    rN = N0;
}
//访问x的数值
int Coordinate::X(){
    return x;
}
//访问y的数值
int Coordinate::Y(){
    return y;
}
//返回N的平方
int Coordinate::N(){
    return rN*rN;
}
//得到滑块的下标
int Coordinate::retIndex()
{
    return (rN*x+y);
}
//修改位置
void Coordinate::setIndex(int a, int b)
{
    x = a;
    y = b;
}
